<{include file="header.html"}>

<script type="text/javascript">

	function validate()
	{
		var firstname = document.getElementById('FIRST_NAME');
        var lastname = document.getElementById('FIRST_NAME');
        var phone = document.getElementById('PHONE');
        var email = document.getElementById('EMAIL');
        
        

		// checking NAME
		if(isEmptyTextBox(firstname, '<{$smarty.const._LB_FIRSTNAME_IS_EMPTY|utf8_escape_js}>'))
			return false;

		if(!isValidLengthTextBox(firstname, <{$smarty.const.MAX_LENGTH_NAME}>, '<{$smarty.const._LB_FIRSTNAME_IS_TOO_LONG|utf8_escape_js}>')){
            return false;
        }
        
        if(isEmptyTextBox(lastname, '<{$smarty.const._LB_LASTNAME_IS_EMPTY|utf8_escape_js}>'))
			return false;

		if(!isValidLengthTextBox(lastname, <{$smarty.const.MAX_LENGTH_NAME}>, '<{$smarty.const._LB_LASTNAME_IS_TOO_LONG|utf8_escape_js}>')){
            return false;
        }
        
        if(!isValidLengthTextBox(phone, <{$smarty.const.MAX_LENGTH_NAME}>, "<{$smarty.const._MSG_TELEPHONE_IS_TOO_LONG|utf8_escape_js}>"))
		{
			return false;
		}
        
        if(isEmptyTextBox(email, '<{$smarty.const._LB_EMAIL_IS_EMPTY|utf8_escape_js}>'))
			return false;
        if(!isValidLengthTextBox(email, <{$smarty.const.MAX_LENGTH_NAME}>, '<{$smarty.const._MSG_EMAIL_IS_TOO_LONG|utf8_escape_js}>')){
            return false;
        }
        
        if(!isValidEmail(email,'<{$smarty.const._LB_INVALID_EMAIL|utf8_escape_js}>')){
            return false;
        }
        
        <{if !$user->ID}>
        var pass = document.getElementById('PASS');
        var repass = document.getElementById('REPASS');
        
        
        if(isEmptyTextBox(pass, '<{$smarty.const._LB_PASSWORD_IS_EMPTY|utf8_escape_js}>'))
			return false;
        
        if(!isValidLengthTextBox(pass, <{$smarty.const.MAX_LENGTH_PASSWORD}>, '<{$smarty.const._MSG_PASSWORD_IS_TOO_LONG|utf8_escape_js}>')){
            return false;
        }
        
        if(!isValidMinLengthTextBox(pass, <{$smarty.const.MIN_LENGTH_PASSWORD}>, '<{$smarty.const._MSG_PASSWORD_IS_TOO_SHORT|utf8_escape_js}>')){
            return false;
        }
        
        if(pass.value != repass.value){
            showErrorBubble(pass, '<{$smarty.const._LB_PASSWORD_DOESNT_MATCH|utf8_escape_js}>');
            return false;
        }
        <{/if}>
        // check whether or not email exist
		var agr = new Array();
		agr.push(email.value);
		agr.push('<{$user->ID}>');

		if(callFunction("Login::emailExistByLoginID", agr))
		{
			showErrorBubble(email, "<{$smarty.const._MSG_EXIST_EMAIL|utf8_escape_html}>" );
			return false;
		}
		document.user_form.submit();
	}



</script>

		<div class="box_two_third">
			<div class="box_head"><{$smarty.const._LB_ACCOUNT_MANAGEMENT|utf8_escape_html}></div>
			<div class="box_content">

				<form action="<{$smarty.server.REQUEST_URI}>" method="post" name="user_form">
				<input type="hidden" id="ID" value="<{$user->ID}>"/>
				<input type="hidden" id="act" name="act" value="<{$smarty.const.ACT_VALID_EDIT}>"/>
				<table>
					<tr>
						<td width="20%"><{$smarty.const._LB_FIRST_NAME|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
						<td colspan="3"><input name="FIRST_NAME" id="FIRST_NAME" type="text" size="<{$smarty.const.SIZE_NAME}>" value="<{$user->FIRST_NAME|utf8_escape_html}>" /></td>
					</tr>
                    <tr>
						<td ><{$smarty.const._LB_LAST_NAME|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
						<td colspan="3"><input name="LAST_NAME" id="LAST_NAME" type="text" size="<{$smarty.const.SIZE_NAME}>" value="<{$user->LAST_NAME|utf8_escape_html}>" /></td>
					</tr>
                    <tr>
						<td ><{$smarty.const._LB_EMAIL|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
						<td colspan="3"><input name="EMAIL" id="EMAIL" type="text" size="<{$smarty.const.SIZE_NAME}>" value="<{$user->EMAIL|utf8_escape_html}>" /></td>
					</tr>
                    <tr>
						<td ><{$smarty.const._LB_TELEPHONE|utf8_escape_html}>&nbsp;:&nbsp;</td>
						<td colspan="3"><input name="PHONE" id="PHONE" type="text" size="<{$smarty.const.SIZE_NAME}>" value="<{$user->PHONE|utf8_escape_html}>" /></td>
					</tr>
                    <{if !$user->ID}>
                    <tr>
						<td ><{$smarty.const._LB_PASSWORD|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
                        <td colspan="3"><input name="PASS" id="PASS" type="password" size="<{$smarty.const.SIZE_NAME}>" value="" /></td>
					</tr>
                    <tr>
						<td ><{$smarty.const._LB_REPEAT_PASSWORD|utf8_escape_html}>&nbsp;:&nbsp;<{$smarty.const._LB_REQUIRE_FIELD}></td>
						<td colspan="3"><input name="REPASS" id="REPASS" type="password" size="<{$smarty.const.SIZE_NAME}>" value="" /></td>
					</tr>
                    <{/if}>
                    <tr>
						<td ><{$smarty.const._LB_DISABLED|utf8_escape_html}>&nbsp;:&nbsp;</td>
						<td colspan="3"><input type="checkbox" value="1" name="DISABLED" <{if $user->DISABLED}>checked<{/if}>/></td>
					</tr>
					<tr>
						  <td class="submit" colspan="4" style="padding-top:10px"><br />
								<a class="tribullet" href="<{$backlink}>"><{$smarty.const._LB_BACK}></a>
								<a class="tribullet" href="#" onclick="validate()"><{$smarty.const._LB_VALIDATE}></a>
							</td>
						</tr>

				</table>
				</form>

			</div>
		</div>
<{include file="footer.html"}>
